//Source file: C:\\javier\\mario\\Java\\taladro\\maquina\\Columna.java

package taladro.maquina;

import java.util.*;
import taladro.control.ControlMotor;

/**
 * <p>
 * </p>
 */
public class Columna 
{
   
   /**
    * /////////////////////////////////////
    * attributes
    * <p>
    * Represents ...La resoluci&#243;n de la cuerda del eje. Se mide en mm/paso
    * </p>
    */
   private double resCuerda;
   private double despMax_Z;
   private double posMov;
   private double posFresar;
   private ControlMotor contMotor;
   private Motor motor;
   private Herramienta herramienta;
   
   /**
    * @param resCuerda
    * @param despMax
    * @param motor
    * @roseuid 3F372F8102B9
    */
   public Columna(double resCuerda, double despMax, Motor motor) 
   {
       this.setResCuerda(resCuerda);
       setDespMax_Z(despMax);
       this.setMotor(motor);
       setContMotor(new ControlMotor(resCuerda, motor));    
   }
   
   /**
    * /////////////////////////////////////
    * access methods for associations
    * @return taladro.maquina.Motor
    * @roseuid 3F341CC40176
    */
   public Motor getMotor() 
   {
        return motor;    
   }
   
   /**
    * @param motor
    * @roseuid 3F341CC40194
    */
   public void setMotor(Motor motor) 
   {
        this.motor = motor;    
   }
   
   /**
    * /////////////////////////////////////
    * operations
    * <p>
    * Does ...
    * </p><p>
    * </p><p>
    * @param x ...
    * </p>
    * @throws java.lang.InterruptedException
    * @roseuid 3F341CC401BD
    */
   public void mover(double x) throws java.lang.InterruptedException 
   {        
        getContMotor().mover(x);
        getContMotor().join();    
   }
   
   /**
    * end mover        
    * <p>
    * Does ...
    * </p><p>
    * </p>
    * 
    * @throws java.lang.InterruptedException
    * @roseuid 3F341CC401D0
    */
   public void moverPuntoCero() throws java.lang.InterruptedException 
   {        
        getContMotor().moverPosCero();
        getContMotor().join();
   }
   
   /**
    * end moverPuntoCero
    * <p>
    * Does ...
    * </p><p>
    * </p>
    * 
    * @throws java.lang.InterruptedException
    * @roseuid 3F341CC401DA
    */
   public void levantarTaladro() throws java.lang.InterruptedException 
   {
        mover( this.getDespMax_Z() - getPosMov() - getHerramienta().getLargo() );
   }
   
   /**
    * end levantarTaladro        
    * <p>
    * Does ...
    * </p><p>
    * </p>
    * 
    * @throws java.lang.InterruptedException
    * @roseuid 3F341CC401E4
    */
   public void barrenar() throws java.lang.InterruptedException 
   {
        mover( this.getDespMax_Z() - getHerramienta().getLargo() + getPosFresar() );
   }
   
   public void fresar() throws java.lang.InterruptedException 
   {
        mover( this.getDespMax_Z() - getHerramienta().getLargo() + getPosFresar() );
   }
   
   /**
    * @param herramienta
    * @roseuid 3F37435C0060
    */
   public void setHerramienta(Herramienta herramienta) 
   {
        this.herramienta = herramienta;    
   }
   
   /**
    * @return double
    * @roseuid 3F3751640079
    */
   public double getPosMov() 
   {
    return posMov;    
   }
   
   /**
    * @param posMov
    * @roseuid 3F37516E018B
    */
   public void setPosMov(double posMov) 
   {
        this.posMov = posMov;    
   }
   
   /**
    * @param sepMax
    * @roseuid 3F375181005C
    */
   public void setLargoEjeZ(double sepMax) 
   {
        this.setDespMax_Z(sepMax);    
   }
   
   /**
    * @return double
    * @roseuid 3F3751A20078
    */
   public double getLargoEjeZ() 
   {
        return this.getDespMax_Z();    
   }
   
   /**
    * @return double
    * @roseuid 3F3758AA015C
    */
   public double getPosActual() 
   {
        return getContMotor().getPosActual();    
   }
   
   /**
    * @roseuid 3F37E5E600B5
    */
   public void cancelar() throws java.lang.SecurityException 
   {
        getContMotor().interrupt();
   }

    public double getResCuerda() {
        return resCuerda;
    }

    public void setResCuerda(double resCuerda) {
        this.resCuerda = resCuerda;
    }

    public double getDespMax_Z() {
        return despMax_Z;
    }

    public void setDespMax_Z(double despMax_Z) {
        this.despMax_Z = despMax_Z;
    }

    public double getPosFresar() {
        return posFresar;
    }

    public void setPosFresar(double posFresar) {
        this.posFresar = posFresar;
    }

    public ControlMotor getContMotor() {
        return contMotor;
    }

    public void setContMotor(ControlMotor contMotor) {
        this.contMotor = contMotor;
    }

    public Herramienta getHerramienta() {
        return herramienta;
    }
}
/**
 * 
 * 
 * 
 * 
 * 
 *  end Columna
 *  
 *  
 *  
 *  
 *  
 */
